<?php
/**
 * Created by PhpStorm.
 * User: changyifan
 * Date: 2018/1/4
 * Time: 下午12:16
 * 教学方案管理
 */

namespace Home\Controller;
use Think\Controller;

class TeachMethodController extends MainController{
    /* <-------------     教学方案管理   -------------> */
    public function teach_method_manage(){
        $this -> assign('course_info',$this->teachercourse->getTeacherCourseNounInfoListWithCurrentTeacher());
        $this -> assign('language_info',$this->language->getLanguageInfoListByAll());
        $this->display();
    }
    public function teaching_method_ShowDatatables(){
        $course_id = I('course_id');
        $result['aaData'] = $this->teachingmethod->getTeachingMethodListWithCourse($course_id);
        echo json_encode($result);
    }
    public function add_teachermethod(){
        $data = I();
        $result = $this->event->add_data($this->teachingmethod_dao,$data);
        echo json_encode($result);
    }
    public function edit_teachermethod(){
        $data = I();
        $result = $this->event->edit_data($this->teachingmethod_dao,$data);
        echo json_encode($result);
    }
    public function delete_teachermethod(){
        $data = I();
        $result = $this->event->delete_data($this->teachingmethod_dao,$data);
        echo json_encode($result);
    }
    /* <-------------       章节管理    -------------> */
    public function teach_method_chapter_manage(){
        $this -> assign('course_info',$this->teachercourse->getTeacherCourseNounInfoListWithCurrentTeacher());
        $this->assign('teacher_medthod_info',$this -> teachingmethod -> getTeachingMethodInfoListByAll());
        $this->display();

    }
    public function chapter_ShowDatatables(){
		$method_id = I('teacher_method_id');
		$result['aaData'] = $this->chapter->getChapterInfoListWithCourseName($method_id);
        echo json_encode($result);
    }
	public function reOrder(){
		$list = I('exchangeList');
		$info =  $this -> chapter_dao -> reOrder($list);
		if($info){
			$result['state'] = true;
		}else{
			$result['state'] = false;
			$result['info'] = '部分更新失败，请刷新页面后重试';
		}
		echo json_encode($result);
	}
	public function section_ShowDatatables(){
		$chapter_id = I('chapter_id');
        $result['aaData'] = $this->section->getSectionInfoListWithCourseName($chapter_id);
        echo json_encode($result);
	}
    public function reOrder_Sec(){
        $list = I('exchangeList');
        $info =  $this -> section_dao -> reOrder($list);
        if($info){
            $result['state'] = true;
        }else{
            $result['state'] = false;
            $result['info'] = '部分更新失败，请刷新页面后重试';
        }
        echo json_encode($result);
    }
    public function add_chapter(){

    }

    /* <-------------       视频管理    -------------> */
    public function teach_method_video_manage(){
        $this->display();
    }
    /* <-------------       资料管理    -------------> */
    public function teach_method_study_manage(){
        $this->display();
    }
    /* <-------------       课堂讨论管理    -------------> */
    public function teach_method_discuss_manage(){
        $this->display();
    }
    /* <-------------       作业管理    -------------> */
    public function teach_method_homework_manage(){

        $this->assign('teach_method_info',$this->event->getTeacherMethodList());
        $this->assign('chapter_info',$this->event->getChapterList());
        $this->display();
    }
    public function homework_ShowDatatables(){
        $chapter_id = I('chapter_id');
        $result['aaData'] = $this->homework->getHomeworkInfoListWithCourseName($chapter_id);
        echo json_encode($result);
    }
    /* <-------------       导入作业    -------------> */
    public function export_homework(){
        $chapter_id = I('chapter_id');
        $this->assign('point_info',$this->event->getPointInfoList());
        $this->assign('exekind_info',$this->exetype->getExeTypeInfo());
        $this->assign('difficulty_info',$this->difficulty->getDiffInfo());
        $this->display();
    }
    public function exercise_ShowDatatables(){
        $poi_id   = I('point_id');
        $exe_type = I('exe_type');
        $exe_diff = I('exe_diff');
        $result['aaData'] = $this->exercise->getExerciseInfoList($poi_id,$exe_type,$exe_diff);
        echo json_encode($result);
    }
    /* <-------------       测试管理    -------------> */
    public function teach_method_test_manage(){
        $this->assign('teach_method_info',$this->teachingmethod->getTeachingMethodInfoListByAll());
        $this->assign('chapter_info',$this->chapter->getChapterInfoListByAll());
        $this->display();
    }
    public function textRule_ShowDatatables(){
        $chapter_id = I('chapter_id');
        $result['aaData'] = $this->textrule -> getTestRuleInfoListWithChapterrId($chapter_id);
        echo json_encode($result);
    }
    /* <-------------       练习管理    -------------> */
    public function teach_method_practice_manage(){
        $this->assign('teach_method_info',$this->teachingmethod->getTeachingMethodInfoListByAll());
        $this->assign('chapter_info',$this->chapter->getChapterInfoListByAll());
        $this->assign('section_info',$this->section->getSectionInfoListByAll());
        $this->display();
    }
    public function practice_ShowDatatables(){
        $section_id = I('section_id');
        $result['aaData'] = $this->practice->getPracticeInfoListWithCourseName($section_id);
        echo  json_encode($result);
    }







}